# Contributor: Andrej Kolchin <KAAtheWise@protonmail.com>
# Maintainer: Andrej Kolchin <KAAtheWise@protonmail.com>
pkgname=vale
pkgver=3.4.2
pkgrel=0
pkgdesc="A markup-aware linter for prose built with speed and extensibility in mind"
url="https://vale.sh/"
arch="all"
license="MIT"
makedepends="go"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/errata-ai/vale/archive/v$pkgver.tar.gz"

export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"
export GOFLAGS="$GOFLAGS -modcacherw"

build() {
	go build -ldflags "-X main.version=v$pkgver" -o bin/vale ./cmd/vale
}

check() {
	go test ./internal/core ./internal/lint ./internal/check ./internal/nlp ./internal/glob ./cmd/vale
}

package() {
	install -Dm755 bin/vale -t "$pkgdir"/usr/bin

	install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}

sha512sums="
e6d6ec06d968ac35abf7f08eb5938b46f2e0162c511acef89f0307ba8a917cd7b9b9c3e0ddee50b720e845252991a88a5fa52f9cc3f9415130147db7c2256dac  vale-3.4.2.tar.gz
"
